#ifndef	__scene_h__
#define	__scene_h__

#include "inccommon.h"

namespace pugi { class xml_node; };
namespace rtMath { class vec3; };

class Material;
class Texture;
class SceneShape;
class SceneLight;
class SceneCamera;

class Scene
{
public:
	Scene();
	~Scene();

	bool				LoadFromFile(const rtString& fileName);
	int					GetMaterialsCount(void) const;
	const Material*		GetMaterial(int idx) const;
	int					FindMaterial(const rtString& materialName) const;
	int					GetTexturesCount(void) const;
	const Texture*		GetTexture(int idx) const;
	int					FindTexture(const rtString& textureName) const;
	int					GetShapesCount(void) const;
	const SceneShape*	GetShape(int idx) const;
	int					GetLightsCount(void) const;
	const SceneLight*	GetLight(int idx) const;
	SceneCamera*		GetCamera(void) const;

private:
	rtMath::vec3		ReadVectorFromXml(pugi::xml_node& node, const rtString& vecName);
	bool				ReadMaterial(pugi::xml_node& node);
	bool				ReadObject(pugi::xml_node& node);
	SceneShape*			ReadShape(pugi::xml_node& node);
	SceneLight*			ReadLight(pugi::xml_node& node);
	int					CreateTexture(const rtString& textureName);

private:
	typedef	std::vector<Material*>		materialsVec;
	typedef	std::vector<Texture*>		texturesVec;
	typedef	std::vector<SceneShape*>	shapesVec;
	typedef	std::vector<SceneLight*>	lightsVec;

	rtString		m_SceneLoadDir;
	materialsVec	m_Materials;
	texturesVec		m_Textures;
	shapesVec		m_Shapes;
	lightsVec		m_Lights;
	SceneCamera*	m_Camera;
};

#endif	// __scene_h__
